﻿#include <iostream>
#include <CL/opencl.h>

char buffer[256];

int main()
{
	cl_int err;
	cl_platform_id platform[10];
	cl_uint size_p;

	err = clGetPlatformIDs(10, platform, &size_p);
	if (err != CL_SUCCESS) {
		printf("Cannot find any platform");
		return 1;
	}
	for (unsigned i = 0; i < size_p; i++) {
		clGetPlatformInfo(platform[i], CL_PLATFORM_NAME, 255, buffer, NULL);
		printf("Platform %u: %s\n", i, buffer);

		cl_device_id device[20];
		cl_uint size_d;
		err = clGetDeviceIDs(platform[i], CL_DEVICE_TYPE_ALL, 100, device, &size_d);
		for (unsigned j = 0; j < size_d; j++) {
			clGetDeviceInfo(device[j], CL_DEVICE_NAME, 255, buffer, NULL);
			printf("    Device %u.%u: %s\n", i, j, buffer);
		}
	}

	return 0;
}
